1. Field of the Invention
The present invention relates generally to antialiasing in computer graphics, and more particularly to antialiasing of texture edges.
2. Related Art
As is well known, a texture is a modulation of color, intensity, transparency, and/or other surface properties. A texture is applied to the surface of a graphics object in such a way that the texture appears attached to the surface as the viewpoint, perspective, and magnification of the object varies. Accordingly, textures are used in computer graphics to provide visual detail for surfaces of graphics objects. A texture includes a plurality of texture elements, called texels.
A color value and an opacity value are associated with each texel. A texel's color value (typically comprising red, green, and blue values) denotes the color of the texel. A texel's opacity value (also called the alpha value, or r) denotes the opacity of the texel. Total transparency is typically indicated by an alpha value of zero. Total opaqueness is typically indicated by an alpha value of one. Partial opaqueness is indicated by an alpha value between zero and one.
FIG. 1 is a representation of an example texture 102 having an image of a tree. A portion of an edge of this texture (i.e., a portion of the outline of the tree) is denoted by reference numeral 104. For illustrative purposes, suppose that this texture edge portion 104 is represented by texel 206B shown in FIG. 2 (for purposes of reference, texel 206B is called an edge texel). This texel 206B is straddled by texels 206A and 206C. Note that texels 206A and 206C are non-edge texels, since texel 206A is outside of the tree, and texel 206C is inside the tree. Example alpha values of texels 206A-206C are shown in FIG. 2. Note that the texture edge 104 is characterized by a transition from an alpha value of 0 (in texel 206A) to an alpha value of 1 (in texel 206B).
During magnification operations, each texel may affect multiple pixels of a graphics object, such as a polygon surface. For example, FIG. 2 shows an example where each texel of texture 102 covers (or affects) four pixels. In particular, texel 206B covers pixels 208B-208E. These pixels 208B-208E conventionally represent the texture edge in the resulting, magnified image. Texel 206A covers four pixels, including pixel 208A (the other three pixels are not shown for simplicity). Likewise, texel 206C covers four pixels, including pixel 208F (the other three pixels are not shown for simplicity).
When a texel covers multiple pixels, the texel's color value and alpha value are typically resampled in some manner and applied to all of the covered pixels. In particular, with respect to alpha values and in the case of an edge texel, the alpha value of an edge texel is typically spread among the covered pixels, such that there is a gradual transition (i.e., a ramp up) from an alpha value of 0 to an alpha value of 1.
In the example of FIG. 2, the alpha value of edge texel 206B is spread among pixels 208B-208E, such that the alpha value of pixel 208B is 1/4, the alpha value of pixel 208C is 1/2, the alpha value of pixel 208D is 3/4, and the alpha value of pixel 208E is 1. More generally, the alpha value of pixel 208B is 1/N, the alpha value of pixel 208C is 2/N, the alpha value of pixel 208D is (N-1)/N, and the alpha value of pixel 208E is N, where N is equal to the number of pixels covered by each texel (in this case, N is equal to 4). Ramp 216 depicts this ramping up of the alpha values over the projected texture edge (a "projected texture edge" is a texture edge, such as edge 104, that has been applied or projected to a polygon surface).
This typical approach for magnifying textures is not ideal, since the projected texture edges become blurry. Such blurriness results from having a multi-pixel wide projected texture edge, instead of having a single pixel wide projected texture edge. For example, after magnification, the projected texture edge in FIG. 2 is composed of four pixels 208B-208E. Such blurriness in the projected texture edge is a form of aliasing.
Thus, what is required is a system and method of antialiasing texture edges during magnification operations.